package main

import (
	"fmt"
	"learning_go/small_practise/week2/server"
	"strconv"
	"time"
)

/**
  这里函数的主入口
*/
func main() {

	mq := make(chan string, 10)

	for i := 0; i < 3; i++ {
		go func(i int) {
			//f:=new(sync.Mutex)
			//f.Lock()
			//defer f.Unlock()
			name := "producer" + strconv.Itoa(i)
			server.Producer(name, 3, mq)
		}(i)
	}

	go func() {
		for {
			fmt.Println("get message is", <-mq)
		}

	}()

	time.Sleep(60 * time.Second)

}
